package com.inbound;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;

public class IdleStateProcessHandler extends ChannelInboundHandlerAdapter{
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx,Object evt){
        if (evt instanceof IdleStateEvent){
        	if( ((IdleStateEvent) evt).state()==IdleState.READER_IDLE )
            ctx.close();
        }
        else
            ctx.fireUserEventTriggered(evt);
    }
}
